<form id="menu_url" action='index.php?app=site&ctl=admin_smallprogram_index&act=save' method='POST' class="tableform">
    <input type='hidden' name='menu[id]' value='<{$menu.id}>' />
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <{input type="hidden" name="shuffling[id]" value=$shuffling.id}>
        <tr >
            <th><{t}>轮播图标题：<{/t}></th>
            <td><{input type="text" name="shuffling[title]" value=$shuffling.title vtype='required' size=30 }></td>
        </tr>
        <tr>
            <th><{t}>跳转地址：<{/t}></th>
            <td id="ctpl_list">
                <div>
                    <label><input name="link_type" type="radio" value="goods" <{if($link_type=='goods')}>checked="checked"<{/if}> /> 商品</label>
                    　　
                    <label><input name="link_type" type="radio" value="category" <{if($link_type=='category')}>checked="checked"<{/if}> /> 分类</label>
                    　　
                    <label><input name="link_type" type="radio" value="tag" <{if($link_type=='tag')}>checked="checked"<{/if}> /> 标签</label>
                    　　
                    <label><input name="link_type" type="radio" value="selftag" <{if($link_type=='selftag')}>checked="checked"<{/if}> /> 自定义</label>
                </div>
            </td>
        </tr>
        
        <tr id="btn_goods" style="display: <{if($link_type!='goods')}>none<{/if}>">
            <th><{t}>商品：<{/t}></th>
            <td>
                <{input type="object" app=b2c object="goods" value=$goods_id name="goods_id" cols="name"  select="radio"}>
            </td>
        </tr>
        
        <tr id="btn_pt" style="display: <{if($link_type!='category')}>none<{/if}>">
            <th><{t}>商品分类：<{/t}></th>
            <td>
                <{input type="object" app=b2c object="goods_cat" value=$cat_id name="cat_id" cols="name"  select="radio" }>
            </td>
        </tr>
        
        <tr id="btn_tag" style="display: <{if($link_type!='tag')}>none<{/if}>">
            <th><{t}>商品标签：<{/t}></th>
            <td>
                <{input type="object" app=desktop object="tag" value=$tag_id name="tag_id" cols="name"  select="radio"  }>
            </td>
        </tr>
        <tr id="self_tag" style="display: <{if($link_type!='selftag')}>none<{/if}>">
            <th><{t}>自定义链接：<{/t}></th>
            <td>
                <{input type="test" name="self_tag" size="30" value=$self_tag }>
            </td>
        </tr>
        
        <tr>
            <th><{t}>排序：<{/t}></th>
            <td><{input type="text" name="shuffling[display_order]" value=$shuffling.display_order|default:0 vtype='required&&number' size=4 }>
            * 数字越大越靠前
            </td>
        </tr>
        <tr>
            <th><{t}>轮播图片：<{/t}></th>
            <td>
                 <span>
            <{assign var=name_spec_image value="shuffling[images]"}>
             <{input  type='image' name=images value=$shuffling.images}>
            </span>
            690*400
            </td>
        </tr>
        <tr style="display: none">
            <th><{t}>轮播图文字：<{/t}></th>
            <td><{input type="text" name="shuffling[tostr]" value=$shuffling.custom_url }></td>
        </tr>
        <tr style="display: none">
            <th><{t}>轮播图页面地址：<{/t}></th>
            <td>
                <select name='shuffling[base]'>
                    <{foreach from=$base item=item key=key}>
                    <option value="<{$key}>"><{t}><{$item}><{/t}></option>
                    <{/foreach}>
                </select>
            </td>
        </tr>
        <tr style="display: none">
            <th><{t}>轮播图显示位置：<{/t}></th>
            <td>
                <select name='shuffling[location]'>
                    <{foreach from=$location item=item key=key}>
                    <option value="<{$key}>"><{t}><{$item}><{/t}></option>
                    <{/foreach}>
                </select>
            </td>
        </tr>
        <tr>
            <th><em class="c-red">*</em><{t}>是否开启：<{/t}></th>
            <td>
                <{input type="bool" name="shuffling[is_open]" value=$shuffling.is_open }>
            </td>
        </tr>
    </table>
    <div class="table-action">
        <{button type='submit' label=$___a='保存'|t:'site' }>
    </div>

</form>

<script>
    $('menu_url').store('target',{
        onComplete:function(){
            if($('menu_url').getParent('.dialog'))
                $('menu_url').getParent('.dialog').retrieve('instance').close();
        }
    });

    $ES('input[type=radio]','ctpl_list').each(function(el,i){
        el.addEvent('click',function(e){
            $('btn_pt').setStyle('display','none')
            $('btn_goods').setStyle('display','none')
            $('btn_tag').setStyle('display','none')
            $('self_tag').setStyle('display','none')
            switch ($(this).value){
                case "category":
                    $('btn_pt').setStyle('display','')
                    break;
                case "goods":
                    $('btn_goods').setStyle('display','')
                    break;
                case "tag":
                    $('btn_tag').setStyle('display','')
                    break;
                case "selftag":
                    $('self_tag').setStyle('display','')
                    break;
            }
        })
    })

</script>